/*
 * traininfo.h
 *
 *  Created on: 2013-2-14
 *      Author: panqiuhui
 */

#ifndef TRAININFO_H_
#define TRAININFO_H_
#include "userinfo.h"
#include "orderinfo.h"

#define STATIONS_STATION_NAME_LEN 45
#define STATIONS_CITY_LEN 45
#define STATIONS_START_SALE_TIME_LEN 9

#define TRAIN_NUMBER_DATE_LEN 11
#define TRAIN_NUMBER_TRAINID_LEN 10

#define THROUGH_STATIONS_ARRIVE_TIME_LEN 9
#define THROUGH_STATIONS_DEPART_TIME_LEN 9
#define THROUGH_STATIONS_CONSUME_TIME_LEN 9
#define THROUGH_STATIONS_PRICE_LEN 11

#define TRAINS_TRAINID_LEN 10
#define TRAINS_TYPE_LEN 45
#define TRAINS_DEPARTSTATIONS_LEN 45
#define TRAINS_ARRIVESTATIONS_LEN 45
#define TRAINS_DEPARTDATE_LEN 11
#define TRAINS_DEPARTTIME_LEN 9
#define TRAINS_ARRIVETIME_LEN 9
#define TRAINS_CONSUMETIME_LEN 9

enum {
	TYPE_QUERY_SQLETIME,
	TYPE_SEARCH_TRAIN_NUM,
	TYPE_SEARCH_START_END_STATION,
	TYPE_SEARCH_STATION_PASS_TRAIN,
	TYPE_SEARCH_TICKET_LEFT,
	TYPE_BUY_TICKET
};

enum {
	TYPE_PASS_STATION_ALL,
	TYPE_PASS_STATION_BEGIN,
	TYPE_PASS_STATION_END,
	TYPE_PASS_STATION_BEGIN_END,
	TYPE_PASS_STATION_PASS
};

enum {
	TYPE_TRAIN_TYPE_DG = 1,
	TYPE_TRAIN_TYPE_Z = 2,
	TYPE_TRAIN_TYPE_T = 4,
	TYPE_TRAIN_TYPE_K = 8,
	TYPE_TRAIN_TYPE_OTHER = 16,
	TYPE_TRAIN_TYPE_ALL = 31
};

struct traininfo {
	char trainID[TRAINS_TRAINID_LEN];
	char type[TRAINS_TYPE_LEN];
	char departStation[TRAINS_DEPARTSTATIONS_LEN];
	char arriveStation[TRAINS_ARRIVESTATIONS_LEN];
	char departTime[TRAINS_DEPARTTIME_LEN];
	char arriveTime[TRAINS_ARRIVETIME_LEN];
	char consumeTime[TRAINS_CONSUMETIME_LEN];
};

struct stationinfo {
	char stationName[STATIONS_STATION_NAME_LEN];
	char city[STATIONS_CITY_LEN];
	char startSaleTime[STATIONS_START_SALE_TIME_LEN];
};

struct ticket_saled_info {
	struct traininfo train;
	struct orderinfo order;
};

struct stations_timeinfo {
	char startStation[STATIONS_STATION_NAME_LEN];
	char endStation[STATIONS_STATION_NAME_LEN];
	char startTime[THROUGH_STATIONS_DEPART_TIME_LEN];
	char endTime[THROUGH_STATIONS_ARRIVE_TIME_LEN];
	char consumeTime[THROUGH_STATIONS_CONSUME_TIME_LEN];
};

struct train_number_request {
	char date[TRAIN_NUMBER_DATE_LEN];
	char trainID[TRAIN_NUMBER_TRAINID_LEN];
};

struct train_start_end_station_request {
	char date[TRAIN_NUMBER_DATE_LEN];
	char startStation[STATIONS_STATION_NAME_LEN];
	char endStation[STATIONS_STATION_NAME_LEN];
	int passStationType;
	int trainType;
};

struct station_pass_train_request {
	char stationName[STATIONS_STATION_NAME_LEN];
	int passStationType;
	int trainType;
};

struct ticket_left_request {
	char startAddress[STATIONS_CITY_LEN];
	char endAddress[STATIONS_CITY_LEN];
	char trainID[TRAIN_NUMBER_TRAINID_LEN];
	char departDate[TRAINS_DEPARTDATE_LEN];
	char timeRangeLow[TRAINS_DEPARTTIME_LEN];
	char timeRangeHigh[TRAINS_DEPARTTIME_LEN];
	int passStationType;
	int trainType;
};

struct buy_ticket_request {
	char trainID[TRAIN_NUMBER_TRAINID_LEN];
	char username[USERNAME_LEN];
	char departDate[TRAINS_DEPARTDATE_LEN];
	char departStation[TRAINS_DEPARTSTATIONS_LEN];
	char arriveStation[TRAINS_ARRIVESTATIONS_LEN];
	float price;
};

struct traininfo_request_type {
	int type;
};

#endif /* TRAININFO_H_ */
